home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / mutex_md.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  1KB  |  40 lines

  1. /*
  2.  * @(#)mutex_md.h    1.10 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*
  16.  * Win32 implementation of mutexes. Here we use critical sections as
  17.  * our mutexes. We could have used mutexes, but mutexes are heavier
  18.  * weight than critical sections. Mutexes and critical sections are
  19.  * semantically identical, the only difference being that mutexes
  20.  * can operate between processes (i.e. address spaces).
  21.  *
  22.  * It's worth noting that the Win32 functions supporting critical
  23.  * sections do not provide any error information whatsoever (i.e.
  24.  * all critical section routines return (void)).
  25.  */
  26.  
  27. #ifndef    _WIN32_MUTEX_MD_H_
  28. #define    _WIN32_MUTEX_MD_H_
  29.  
  30. #include <windows.h>
  31.  
  32. typedef CRITICAL_SECTION mutex_t;
  33.  
  34. #define mutexInit(m)    InitializeCriticalSection(m)
  35. #define mutexDestroy(m)    DeleteCriticalSection(m)
  36. #define mutexLock(m)    EnterCriticalSection(m)
  37. #define mutexUnlock(m)    LeaveCriticalSection(m)
  38.  
  39. #endif    /* !_WIN32_MUTEX_MD_H_ */
  40.